package com.personal.kousuan.random;

import java.util.Random;

import com.personal.kousuan.util.RandomUtil;


public class BuJinWeiRandomGenerator implements RandomGenerator {

	/**
	 * 创建一个随机数，使其与Seed(0-9之间)的相加小于10
	 */
	@Override
	public int generateRandom(int seed) {
		return RandomUtil.generateRandom(0, 10-seed);
	}

	/**
	 * 创建一个随机数，使其与Seed(0-9之间)的相加小于10，但要小于max
	 */
	@Override
	public int generateRandom(int seed, int max) {
/*		//取得Seed的个位
		int seedGeWei = seed % 10;
		//取得0 到seedGeWei的随机数
		
		int gewei = RandomUtil.generateRandom(0, 10 - seedGeWei);
		
		int shiweiBase = (max - seed)/10;
		
		int shiwei = new Random().nextInt(shiweiBase);
		
		return shiwei * 10 + gewei;
*/
		
		return RandomUtil.generateRandom(1, (9-seed) > max?max:(9-seed));
	}

}
